<?php

  /*

      TravianWAP
      Copyright (c) 2007-08 by Ananas - All rights reserved
      http://n00bz.biz/travianwap/
      Contact: uroskn@gmail.com

      --------------------------------------------------------------------------

      This program is free software: you can redistribute it and/or modify
      it under the terms of the GNU  General Public License as published by
      the Free Software Foundation, either version 3 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU  General Public License
      along with this program. If not, see http://www.gnu.org/licenses/.

  */

  define("MODULE_OK", 1);
  if (!defined("MAIN_UNIT")) die("h4xx0r");

  if (!defined("ALLOW_UPDATE")) unset($_GET["check_update"]);

  if (empty($_GET["check_update"]))
  {
    echo '<strong>About TravianWAP</strong><br/><br/>'.
         'TravianWAP version '.TRAVIANWAP_VERSION.'<br/>Released: '.
         date("d.m.Y", TRAVIANWAP_DATE)."<br/>Copyright (c) 2008 by [n00b] (Ananas)<br/><br/>".
         "<b>Components:</b><br/>TravianParser: ".TPARSER_VERSION."<br/>".
         date("d.m.Y", TPARSER_DATE)."<br/><br/>".
         "HTTP client: ".TPARSER_HTTP_NAME."<br/>".
         "Version: ".TPARSER_HTTP_VERSION."<br/>".
         date("d.m.Y", TPARSER_HTTP_DATE)."<br/><br/>";
    if (defined("ALLOW_UPDATE")) print_link('main.php?mod=about&amp;check_update=1'.ps(), "Check for update", "<br/><br/>");
  }

  else
  {
    error_reporting(0);
    echo '<strong>TravianWAP update</strong><br/><br/>';
    $data = http_get(UPDATE_CHECK_SITE."?date=".TRAVIANWAP_DATE);
    $data = explode("\r\n", $data["body"]);
    if ($data[0] == "LATEST") echo 'Your server is running latest version of TravianWAP<br/><br/>';
    else if ($data[0] == "NEW")
    {
      echo "<strong>Newer version available</strong><br/><br/>Version: ".$data[2].
           "<br/>Released: ".date("d.m.Y", $data[1])."<br/><br/>";
    }
    else echo "Unable to reach server, or reply is incorrect.<br/><br/>";
    print_link('main.php?mod=about'.ps(), "Back", "<br/><br/>");
  }

?>

